<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>25canvas坐标变换</title>
</head>
<style>
    canvas {
        border: 1px solid #ccc;
    }
</style>
<body>
<canvas width="600" height="400"></canvas>
<script>
    var myCanvas = document.querySelector('canvas');
    var ctx = myCanvas.getContext('2d');
    //ctx.strokeRect(100,100,100,100);
    /*平移 移动画布的原点*/
    ctx.translate(150, 150);
    /*表示移动目标点的坐标*/

    /*坐标轴缩放*/
    ctx.scale(1, 1);
    /*参数表示宽高的缩放比例 x轴缩放比例 y轴缩放比例*/
    /*旋转坐标轴的角度0*/
    /*  ctx.rotate(Math.PI/6);*/
    var startAngle =0;
    setInterval(function(){
        startAngle+=Math.PI/180;
        ctx.rotate(startAngle);
        ctx.strokeRect(-50, -50, 100, 100);
    },1000);

</script>
</body>
</html>
